<template>
  <div class="table">
    <p style="text-align: right;margin-bottom: 10px; font-size: 14px">单位：元</p>
    <el-table :data="tableData" border :header-cell-style="{
                    background: '#0070C0',
                    color: '#ffffff'
                }" v-loading="tableLoading">
      <el-table-column v-for="item in column" :key="item.prop" :prop="item.prop" :label="item.label" min-width="110" align="center"></el-table-column>
    </el-table>
  </div>
</template>
<script>
import { $budgetAPI } from "@/api";
export default {
  props: {
    params: {
      type: Object,
      default: () => ({}),
    },
  },
  data() {
    return {
      tableLoading: false,
      tableData: [],
      column: [],
    };
  },
  created() {
    this.getList(this.params);
  },
  methods: {
    getList(params) {
      this.tableLoading = true;
      $budgetAPI.listOweAgeDataDay(
        { ...params, flag: 4 },
        (res) => {
          this.tableData = res.content.data;
          this.column = res.content.key.map((it, i) => {
            return {
              prop: it,
              label: res.content.name[i],
            };
          });
          this.tableLoading = false;
        },
        (e) => {
          this.tableLoading = false;
        }
      );
    },
  },
};
</script>